import {createRouter, createWebHistory} from 'vue-router'
import { createRouterGuards } from './guards'
import MyView from '../views/MyView.vue'
import ChangeView from '../views/ChangeView.vue'
import RankView from '../views/RankView.vue'
import stockImages from '../views/StockImages.vue'
import PercentileView from '../views/PercentileView.vue'
// import FilterView from '../views/FilterView3.vue'
import FilterView from '../views/FilterView.vue'
import Login from '../views/Login.vue'
import ForecastRanking from '../components/ranking/forecastRanking.vue'
import SynthesizeRanking from '../components/ranking/synthesizeRanking.vue'
import HxyRanking from '../components/ranking/hxyRanking.vue'
import ZfyRanking from '../components/ranking/zfyRanking.vue'
import FirstCreateWarehouse from '../components/updown/firstCreateWarehouse.vue'
import SellEarnings from '../components/updown/sellEarnings.vue'
import AveCreateWarehouse from '../components/updown/aveCreateWarehouse.vue'

const routes = [
  {
    path: '/',
    name: 'myView',
    component: MyView
  },
  {
    path: '/login',
    name: 'login',
    component: Login,
    meta: {
      requireAuth: false,
      title: '登录'
    }
  },
  {
    path: '/stockImages',
    name: 'stockImages',
    component: stockImages,
  },
  {
    path: '/change',
    name: 'changeView',
    component: ChangeView,
    children: [
      {
        path: 'firstCreateWarehouse',
        name: 'firstCreateWarehouse',
        component: FirstCreateWarehouse
      },
      {
        path: 'sellEarnings',
        name: 'sellEarnings',
        component: SellEarnings
      },
      {
        path: 'aveCreateWarehouse',
        name: 'aveCreateWarehouse',
        component: AveCreateWarehouse
      }
    ]
  },
  {
    path: '/rank',
    name: 'rankView',
    component: RankView,
    children: [
      {
        path: 'ForecastRanking',
        name: 'ForecastRanking',
        component: ForecastRanking
      },
      {
        path: 'synthesizeRanking',
        name: 'SynthesizeRanking',
        component: SynthesizeRanking
      },
      {
        path: 'hxyRanking',
        name: 'HxyRanking',
        component: HxyRanking
      },
      {
        path: 'zfyRanking',
        name: 'ZfyRanking',
        component: ZfyRanking
      }
    ]
  },
  {
    path: '/percentile',
    name: 'percentileView',
    component: PercentileView
  },
  {
    path: '/filter',
    name: 'filterView',
    component: FilterView
  }
]

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: routes,
})

createRouterGuards(router)

export default router
